package xyz.xtt.pay.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import xyz.xtt.pay.entity.TblPayOrderRefundRecord;
import xyz.xtt.pay.mapper.TblPayOrderRefundRecordMapper;
import xyz.xtt.pay.service.ITblPayOrderRefundRecordService;

/**
 * @author dale
 * @date 2025/1/16
 **/
@Service
public class TblPayOrderRefundRecordServiceImpl extends ServiceImpl<TblPayOrderRefundRecordMapper, TblPayOrderRefundRecord> implements ITblPayOrderRefundRecordService {

    /**
     * 根据支付订单id查询退款记录条数
     *
     * @param payOrderId
     * @return
     */
    @Override
    public long countByPayOrderId(Long payOrderId) {
        QueryWrapper<TblPayOrderRefundRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("pay_order_id", payOrderId);
        return count(queryWrapper);
    }
}
